package com.blogspot.ostas.oracle.aq.spring;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

public class OracleAqMessageProducer {
	private JmsTemplate jmsTemplateOracle;

	public void setJmsTemplate(JmsTemplate jmsTemplateOracle) {
		this.jmsTemplateOracle = jmsTemplateOracle;
	}
	public void sendTextMessage(final String messageText)
	{
	  	jmsTemplateOracle.send(new MessageCreator() {
			@Override
			public Message createMessage(Session session) throws JMSException {
				final TextMessage message = session.createTextMessage();
				message.setText(messageText);
				return message;
			}
		});		
	}
}
